package com.mediastory.spsserver.schedule;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import com.mediastory.spsserver.apns.service.ApnsSvc;
import com.mediastory.spsserver.gcm.domain.Gcm;
import com.mediastory.spsserver.gcm.service.GcmSvc;

/**
 * Schedule Ctrl
 * @author Jaewon Choi
 *
 */

@Service
public class ScheduleCtrl  {
	
	@Autowired
	GcmSvc gcmSvc;
	
	@Autowired
	ApnsSvc apnsSvc;
	
	@Scheduled (cron="0 0/30 * * * ?")
	public void schedule() throws Exception {
		// TODO Auto-generated method stub
		
		Gcm gcmObj = new Gcm();
		gcmObj.setModifiedId("schedule");
		gcmObj.setModifiedIp("");
		List<Gcm> result = gcmSvc.sendMsg(gcmObj, true);
		
		// apns
		apnsSvc.push();
		
	}
	


}
